package com.maker997.ajax.controller;

import com.maker997.ajax.dto.JsonResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

/**
 * 获取系统时间
 *
 * @author maker
 * @date 2017/11/03
 */
@Controller
@RequestMapping("/ajax")
public class TimeController {

    @RequestMapping("/time")
    public String time()
    {
        return "time";
    }

    @RequestMapping("/time/now")
    @ResponseBody
    public JsonResult<Long> getTime()
    {
        JsonResult result = new JsonResult(true,new Date().getTime());
        return result;
    }

    @RequestMapping(value = "/checkAccount",method = RequestMethod.GET,produces = {"text/html;charset=utf-8"})
    @ResponseBody
    public String checkAccount(@Param("username") String username)
    {
        System.out.printf(username);
        return username;
    }
}
